home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Rexx / Slideshow.pprx < prev    next >
Text File  |  2000-05-08  |  7KB  |  240 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1995-1997 Cloanto Italia srl */
  2.  
  3. /* $VER: Slideshow.pprx 1.0 */
  4.  
  5. /** ENG
  6.   This is a simple slideshow script. It normally displays all images
  7.   and animations which it finds in the specified directory (and
  8.   subdirectories).
  9.  
  10.   When the script is launched, it first searches for a file named
  11.   "T:pprx_slideshow.list". If this file exists, the script displays the
  12.   artwork files listed in the file. The file must contain two lines for
  13.   each image or animation: the first line containing the path, and the
  14.   second line indicating how often the item should be repeated (useful for
  15.   animations).
  16.  
  17.   To have a slideshow loop automatically and unattended, both the Repeat and
  18.   the Automatic options in the initial requester should be selected.
  19. */
  20.  
  21. /** DEU
  22.   Ein einfaches Skript zur Erzeugung einer Diaschau, welches
  23.   im Normalfall alle Bilder und Animationen im angegebenen Verzeichnis
  24.   (und in dessen Unterverzeichnissen) anzeigt.
  25.  
  26.   Sobald das Skript ausgeführt wird, sucht es zunächst eine Datei
  27.   namens "T:pprx_slideshow.list" und zeigt die darin enthaltenen
  28.   Bilder und Animationen an. Die Datei muß für jedes Bild (oder
  29.   jede Animation) jeweils zwei Zeilen enthalten: Die erste Zeile
  30.   enthält den Pfad, die zweite die gewünschte Anzahl von Wiederholungen
  31.   (besonders geeignet bei Animationen).
  32.  
  33.   Um eine automatisch endlos ablaufende Diaschau zu erzeugen,
  34.   müssen im ersten Dialogfenster die Optionen "Wiederholen" und
  35.   "Automatisch" aktiviert sein.
  36. */
  37.  
  38. /** ITA
  39.   Questo è uno script per creare una semplice proiezione di immagini e
  40.   animazioni. In genere mostra tutte le immagini e le animazioni che trova
  41.   nel cassetto specificato (e negli eventuali cassetti in esso contunuti).
  42.  
  43.   Quando si avvia lo script, esso ricerca per prima cosa un file chiamato
  44.   "T:pprx_slideshow.list". Se tale file esiste, lo script mostra i file grafici
  45.   là elencati. Il file deve contenere due righe per ciascuna immagine o
  46.   animazione: la prima contiene il percorso completo di nome di file, la
  47.   seconda indica quante volte ripetere la voce (utile per le animazioni).
  48.  
  49.   Per ottenere una proiezione che riparta automaticamente
  50.   si dovrebbero selezionare entrambe le opzioni Ripetuto e
  51.   Automatico nella finestra di dialogo iniziale.
  52. */
  53.  
  54. IF ARG(1, EXISTS) THEN
  55.     PARSE ARG PPPORT
  56. ELSE
  57.     PPPORT = 'PPAINT'
  58.  
  59. IF ~SHOW('P', PPPORT) THEN DO
  60.     IF EXISTS('PPaint:PPaint') THEN DO
  61.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  62.         DO 30 WHILE ~SHOW('P',PPPORT)
  63.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  64.         END
  65.     END
  66.     ELSE DO
  67.         SAY "Personal Paint could not be loaded."
  68.         EXIT 10
  69.     END
  70. END
  71.  
  72. IF ~SHOW('P', PPPORT) THEN DO
  73.     SAY 'Personal Paint Rexx port could not be opened'
  74.     EXIT 10
  75. END
  76.  
  77. ADDRESS VALUE PPPORT
  78. OPTIONS RESULTS
  79. OPTIONS FAILAT 10000
  80.  
  81. Get 'LANG'
  82. IF RESULT = 1 THEN DO        /* Deutsch */
  83.     txt_title_filreq  = 'Grafikverzeichnis auswählen'
  84.     txt_title_options = 'Diaschau-Optionen'
  85.     txt_gad_repeat    = 'Wiede_rholen:'
  86.     txt_gad_auto      = 'Auto_matisch:'
  87.     txt_msg_stopped   = 'Diaschau wurde unterbrochen'
  88.     txt_msg_complete  = 'Diaschau beendet'
  89.     txt_err_oldclient = 'Für dieses Skript_ist eine neuere Version_von Personal Paint erforderlich'
  90.     txt_err_nolist    = 'Listendatei konnte nicht_geöffnet werden'
  91. END
  92. ELSE IF RESULT = 3 THEN DO    /* Français */
  93.     txt_title_filreq  = 'Choisir le répertoire des graphismes'
  94.     txt_title_options = 'Options de diaporama'
  95.     txt_gad_repeat    = '_Répéter :'
  96.     txt_gad_auto      = 'Auto_matique :'
  97.     txt_msg_stopped   = 'Le diaporama a été interrompu'
  98.     txt_msg_complete  = 'Diaporama terminé'
  99.     txt_err_oldclient = 'Ce script nécessite une nouvelle_version de Personal Paint'
  100.     txt_err_nolist    = "Impossible d'ouvrir le fichier de liste."
  101. END
  102. ELSE IF RESULT = 2 THEN DO    /* Italiano */
  103.     txt_title_filreq  = 'Selezionare cassetto immagini'
  104.     txt_title_options = 'Opzioni slideshow'
  105.     txt_gad_repeat    = '_Ripetuto:'
  106.     txt_gad_auto      = 'Auto_matico:'
  107.     txt_msg_stopped   = 'Lo slideshow è stato interrotto'
  108.     txt_msg_complete  = 'Slideshow terminato'
  109.     txt_err_oldclient = 'Questa procedura richiede_una versione più recente_di Personal Paint'
  110.     txt_err_nolist    = 'Il file indice non può essere aperto'
  111. END
  112. ELSE DO                /* English */
  113.     txt_title_filreq  = 'Select artwork directory'
  114.     txt_title_options = 'Slideshow Options'
  115.     txt_gad_repeat    = '_Repeat:'
  116.     txt_gad_auto      = 'Auto_matic:'
  117.     txt_msg_stopped   = 'The slideshow has been stopped'
  118.     txt_msg_complete  = 'Slideshow complete'
  119.     txt_err_oldclient = 'This script requires a newer_version of Personal Paint'
  120.     txt_err_nolist    = 'List file could not be opened'
  121. END
  122.  
  123. Version 'REXX'
  124. IF RESULT < 7 THEN DO
  125.     RequestNotify 'PROMPT "'txt_err_oldclient'"'
  126.     EXIT 10
  127. END
  128.  
  129. DeleteFrames 'ALL'
  130. IF RC = 5 THEN
  131.     EXIT 0
  132.  
  133. FreeEnvironment 'QUERY'
  134. IF RC = 5 THEN
  135.     EXIT 0
  136.  
  137. tmpfname = 'T:pprx_slideshow.list'
  138.  
  139. LockGUI
  140.  
  141. IF ~EXISTS(tmpfname) THEN DO
  142.     RequestPath '"'txt_title_filreq'"'
  143.     IF RC = 0 THEN DO
  144.         tmpfname = 'T:pprx_temp.'PRAGMA('ID')
  145.         ADDRESS COMMAND 'List >'tmpfname' 'RESULT' NOHEAD PAT=~(#?.info) LFORMAT="*"%s%s*"*N1" ALL FILES'
  146.     END
  147. END
  148.  
  149. originalbars = ''
  150. listopen = 0
  151. SIGNAL ON Break_C
  152.  
  153. IF EXISTS(tmpfname) THEN DO
  154.     Request '"'txt_title_options'" "CHECK = ""'txt_gad_repeat'"", 0  CHECK = ""'txt_gad_auto'"", 1 "'
  155.     IF RC = 0 THEN DO
  156.         repeat = RESULT.1
  157.         automatic = RESULT.2
  158.         IF automatic THEN
  159.             noprog = ''
  160.         ELSE
  161.             noprog = 'NOPROGRESS'
  162.  
  163.         Get 'BARS'
  164.         originalbars = RESULT
  165.         IF OPEN('listfile', tmpfname, 'R') THEN DO
  166.             listopen = 1
  167.             errcode = 0
  168.             Set '"BARS=0"'
  169.             DO FOREVER
  170.                 prevpos = SEEK('listfile', 0, CURRENT)
  171.                 curfname = READLN('listfile')
  172.                 IF EOF('listfile') THEN DO
  173.                     IF repeat THEN DO
  174.                         SEEK('listfile', 0, BEGIN)
  175.                         ITERATE
  176.                     END
  177.                     ELSE LEAVE
  178.                 END
  179.                 curtimes = READLN('listfile')
  180.                 IF EOF('listfile') THEN DO
  181.                     IF repeat THEN DO
  182.                         SEEK('listfile', 0, BEGIN)
  183.                         ITERATE
  184.                     END
  185.                     ELSE LEAVE
  186.                 END
  187.  
  188.                 IF DATATYPE(curtimes) ~= 'NUM' THEN curtimes = 1
  189.                 curtimes = ABS(curtimes)
  190.                 curtimes = TRUNC(curtimes)
  191.                 IF curtimes < 1 THEN curtimes = 1
  192.  
  193.                 GetFileFormat curfname
  194.                 IF RC = 0 THEN DO
  195.                     IF UPPER(RESULT) = 'ANIM' THEN
  196.                         PlayFile curfname 'TIMES' curtimes 'FORCE QUIET' noprog
  197.                     ELSE DO
  198.                         LoadImage curfname 'FORCE QUIET' noprog
  199.                         IF RC = 0 & automatic THEN
  200.                             ADDRESS COMMAND 'Wait >NIL: 3 SEC'
  201.                     END
  202.                     IF RC = 5 THEN
  203.                         errcode = 5
  204.                     IF RC = 0 & ~automatic THEN DO
  205.                         WaitForClick
  206.                         IF RC ~= 0 THEN
  207.                             errcode = 5
  208.                     END
  209.                 END
  210.                 IF errcode > 0 THEN BREAK
  211.             END
  212.             CALL CLOSE('listfile')
  213.             listopen = 0
  214.             IF errcode > 0 THEN
  215.                 RequestNotify 'PROMPT "'txt_msg_stopped'"'
  216.             ELSE
  217.                 RequestNotify 'PROMPT "'txt_msg_complete'"'
  218.         END
  219.         ELSE
  220.             RequestNotify 'PROMPT "'txt_err_nolist'"'
  221.  
  222.         Set '"BARS='originalbars'"'
  223.     END
  224.     ADDRESS COMMAND 'Delete >NIL: 'tmpfname
  225. END
  226. UnlockGUI
  227. EXIT 0
  228.  
  229.  
  230.  
  231. Break_C:
  232.  
  233.     if originalbars ~= '' THEN
  234.         Set '"BARS='originalbars'"'
  235.     IF listopen THEN
  236.         CALL CLOSE('listfile')
  237.     ADDRESS COMMAND 'Delete >NIL: 'tmpfname
  238.  
  239.     RETURN
  240.